#!/usr/bin/env python
# coding: utf-8

# 请写一个程序来计算斐波那契数列。根据给定的`n`以逗号分隔的形式打印Fibonacci序列。斐波那契数列计算公式如下:
# 
# + $n = 0$：$f (n) = 0$
# + $n = 1$：$f (n) = 1$
# + $n > 1$：$f (n) = f (n - 1) + f (n - 2)$
# 
# 输入：`n=7`
# 
# 预期输出：`0,1,1,2,3,5,8,13`

# In[2]:


def f(n):
    if n < 2:
        fibo[n] = n
        return fibo[n]
    fibo[n] = f(n - 1) + f(n - 2)
    return fibo[n]
n = 7
fibo = [0] * (n + 1)
f(n)
fibo = [str(i) for i in fibo]
ans = ",".join(fibo)
print(ans)

